

Page({
  data: {

    flag: [0, 0, 0],

    startext: ['', '', ''],

    stardata: [1, 2, 3, 4, 5],

  },
  changeColor: function (e) {
    console.log(e)
    var index = e.currentTarget.dataset.index;

    var num = e.currentTarget.dataset.no;

    var a = 'flag[' + index + ']';

    var b = 'startext[' + index + ']';

    var that = this;

    if (num == 1) {

      that.setData({

        [a]: 1,

        [b]: '非常不满意'

      });

    } else if (num == 2) {

      that.setData({

        [a]: 2,

        [b]: '不满意'

      });

    } else if (num == 3) {

      that.setData({

        [a]: 3,

        [b]: '一般'

      });

    } else if (num == 4) {

      that.setData({

        [a]: 4,

        [b]: '满意'

      });

    } else if (num == 5) {

      that.setData({

        [a]: 5,

        [b]: '非常满意'

      });

    }

  }

})
